import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import Vant from "vant";
import "vant/lib/index.css";
// import VueJsonp from 'vue-jsonp'
import { Lazyload } from "vant";
import { Toast } from "vant";
import flvjs from "../node_modules/flv.js";
Vue.use(flvjs);
Vue.use(Toast);
Vue.use(Lazyload);
import { Image as VanImage } from "vant";
import moment from "moment"; //导入文件
Vue.prototype.$moment = moment; //赋值使用
// Vue.http.options.credentials = true
Vue.use(VanImage);
Vue.config.productionTip = false;
// Vue.use(VueJsonp)
Vue.use(Vant);
new Vue({
  router,
  store,
  render: (h) => h(App),

  beforeCreate() {
    let getToken = sessionStorage.getItem("token");
    if (!getToken) {
      //如果没有登录，就跳转到登录页面

      router.push({ name: "Login" });
    } else {
      router.push("/");
    }
  },
}).$mount("#app");
